import * as React from 'react';
import { View, Text } from 'react-native';
import { createStaticNavigation, useNavigation,NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import { Button } from '@react-navigation/elements';
import Login from './views/Login';
import FinishOneself from './views/FinishOneself';
import Tabbar from './views/Tabbar/index';
import LoadList from './views/LoadList/index';
function DetailsScreen() {
  const navigation = useNavigation();
  return (
    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
      <Text>Details Screen</Text>
      <Button onPress={() => navigation.navigate('Home', {name: 'chenming'})}>
        Go to Home... again
      </Button>
    </View>
  );
}
function HomeScreen() {
  const useNav = useNavigation();
  
  return (
    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
      <Text>Home Screen</Text>
      <Button onPress={()=> useNav.navigate('FinishOneself', {name: 'chenming'})}>去FinishOneself</Button>
    </View>
  );
}
const RootStack = createNativeStackNavigator();
export default function Nav() {
  return <NavigationContainer>
    <RootStack.Navigator initialRouteName='LoadList'>
      <RootStack.Screen name="LoadList" component={LoadList}  options={{headerShown: false}}/>
      <RootStack.Screen name="Tabbar" component={Tabbar}  options={{headerShown: false}} />
      <RootStack.Screen name="Login" component={Login}  options={{headerShown: false}} />
      <RootStack.Screen name="FinishOneself" component={FinishOneself}  options={{headerShown: false}}/>
      <RootStack.Screen name="Home" component={HomeScreen} />
      {/* <RootStack.Screen name="Details" component={Details} /> */}
      <RootStack.Screen name="Details" component={DetailsScreen} />
    </RootStack.Navigator>
  </NavigationContainer>;
}